#Analysis run using RStudio 2025.09.2+418 "Cucumberleaf Sunflower" Release (12f6d5e22720bd78dbd926bb344efe12d0dce83d, 2025-10-20) for windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2025.09.2+418 Chrome/138.0.7204.251 Electron/37.6.1 Safari/537.36, Quarto 1.7.32


#######DEFINITIONS OF VARIABLES
# dep.on.eu.trade = trade dependence of PTA partner on EU (with dependence measured as exports + imports with the EU over the PTA partner's total world trade)
# eu.dep.on.trade = trade dependence of the EU on its PTA partner (with dependence measured as exports + imports with the PTA partner over the EU's total world trade)
# dep.on.eu.gdp = trade dependence of PTA partner on EU (with dependence measured as exports + imports over the PTA partner's GDP)
# eu.dep.on.gdp = trade dependence of the EU on its PTA partner (with dependence measured as exports + imports over the EU's GDP)
# trade.gdp.asymmetry = the absolute value of the difference between the trade dependence of the EU on the PTA partner and the trade dependence of the PTA partner on the EU (with trade dependence measured as exports plus imports over GDP)
# trade.share.asymmetry = the absolute value of the difference between the trade dependence of the EU on the PTA partner and the trade dependence of the PTA partner on the EU (with trade dependence measured as exports plus imports over total world trade)



#open relevant libraries
library(survival)
library(ranger)
library(ggplot2)
library(dplyr)
library(ggfortify)
library(rms)
library(readr)
library(haven)
library(texreg)


#OPEN DATASET 
final <- read_csv("Elko_EU_duration_data.csv")




quantile(final$duration, prob=c(.25,.5,.75), type=1, na.rm=TRUE)
#NOTE THAT THE KNOTS CHOSEN BELOW ARE CLOSE TO THE QUANTILES (16, 36, 69). I CHOSE THE NUMBERS 12, 36 and 72 INSTEAD OF THE EXACT QUANTILE NUMBERS BECAUSE THESE CORRESPOND TO A CERTAIN # OF YEARS FOR EASE OF INTERPRETATION


#### GET KAPLAN-MEIER SURVIVAL ESTIMATES
km_fit <- survfit(Surv(t0, duration, neg.end) ~ 1, data=final)
summary(km_fit, times = c(1,24,60,120*(1:10)))
#plot it
plot(km_fit, xlab="Months", ylab="Survival")



################################################################################################################################################################################
##################################################################### ANALYSES FOR PAPER########################################################################################
################################################################################################################################################################################


#PAPER MODEL 1: uses trade as a percent fo GDP for asymmetry measure; includes 5-year windows to control for time negotiation started
test <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model1 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model1
summary(model1)$r
#FOR ASYMMMETRY MEAURE: slope coefficient= 0.0282214  Hazard ratio (exponentiated coefficient): 1.0286234  Raised to the power of 11.59062 (the mean of the % of GDP asymmetry measure): 1.3869




#PAPER MODEL 2: uses trade share for asymmetry measure; includes 5-year windows to control for time negotiation started
test <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model2 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model2
summary(model2)$r
#FOR ASYMMMETRY MEAURE: slope coefficient= 0.019328  Hazard ratio (exponentiated coefficient): 1.019516  Raised to the power of 25.08806 (the mean of the trade share asymmetry measure): 1.624




#PAPER MODEL 3: uses trade as a percent of GDP for asymmetry measure; includes monadic BATNA measures; includes 5-year windows to control for time negotiation started
test <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model3 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + tt(eu.dep.on.trade) + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model3
summary(model3)$r
#FOR ASYMMMETRY MEAURE: slope coefficient= .00727  Hazard ratio (exponentiated coefficient): 1.007  Raised to the power of 11.59062 (the mean of the % of GDP asymmetry measure): 1.0842
#FOR EU TRADE DEPENDENCE (at knot 1): slope coefficient = -112.4; hazard ratio (exponentiated coefficient): 1.529e-49. Raised to the power of 0.005190471 (the mean of the EU trade share dependence measure): 0.55798
#FOR EU TRADE DEPENDENCE (at knot 2) = coefficient at knot 1 plus coefficient at knot 2): slope coefficient = -284.3. hazard ratio: 3.389056e-124.   Raised to the power of 0.005190471: 0.228629
#FOR EU TRADE DEPENDENCE (at knot 3): coefficient at knot 1 plus coefficient at knot 2 plus coefficient at knot 3: slope coefficient = 6.330977e-211. hazard ratio:  raised to the power of 0.005190471: 0.08109
#note for INTERPRETING HAZARD RATIO LESS THAN 1: if the HR for a new drug is 0.75, it means the treatment group has a 25% lower risk of the event
#FOR PARTNER TRADE DEPENDENCE MEAURE: slope coefficient= 1.79  Hazard ratio (exponentiated coefficient): 5.988  Raised to the power of 0.256071 (the mean of the trade share partner BATNA measure): 1.58139




#PAPER MODEL 4: uses trade share for asymmetry measure; includes monadic BATNA measures; includes 5-year windows to control for time negotiation started
test <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model4 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + tt(eu.dep.on.gdp) + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model4
summary(model4)$r
#FOR ASYMMMETRY MEAURE: slope coefficient= 0.016963  Hazard ratio (exponentiated coefficient): 1.017108  Raised to the power of 25.08806 (the mean of the trade share asymmetry measure): 1.53047
#FOR EU TRADE DEPENDENCE (at knot 1): slope coefficient = -2.345736; hazard ratio (exponentiated coefficient): 0.095777 Raised to the power of 0.2820731 (the mean of the EU dependence measure): .51598
#FOR EU TRADE DEPENDENCE (at knot 2) = coefficient at knot 1 plus coefficient at knot 2): slope coefficient = -5.782528  hazard ratio: 0.00308.   Raised to the power of 0.2820731:  .19569
#FOR EU TRADE DEPENDENCE (at knot 3): coefficient at knot 1 plus coefficient at knot 2 plus coefficient at knot 3: slope coefficient = -9.448873 hazard ratio: 0.00007877829 raised to the power of 0.2820731: .0695
#note for INTERPRETING HAZARD RATIO LESS THAN 1: if the HR for a new drug is 0.75, it means the treatment group has a 25% lower risk of the event
#FOR PARTNER TRADE DEPENDENCE MEAURE: slope coefficient= 0.007619  Hazard ratio (exponentiated coefficient): 1.007648  Raised to the power of 11.85189 (the mean of the % of GDP partner BATNA measure): 1.0945


#CREATE TABLES
library(stargazer)

stargazer(model1, model2, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU", align=TRUE, star.cutoffs = c(0.05))
stargazer(model3, model4, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU (includes monadic BATNAs)", align=TRUE, star.cutoffs = c(0.05))



################################################################################################################################################################################
##################################################################### ONLINE APPENDIX ##########################################################################################
################################################################################################################################################################################

# = Online Appendix Model 1 = Paper Model 1 with region dummy variables added
test <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model1 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry +  relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + tt(asia) + factor(middle_east) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model1
summary(model1)$r



# Online Appendix Model 2 = Paper Model 2 with region dummy variables added
test <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model2 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry +  relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model2
summary(model2)$r



# Online Appendix Model 3 = Paper Model 3 with region dummy variables added
test <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model3 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + tt(eu.dep.on.trade) + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + tt(asia) + factor(middle_east) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model3
summary(model3)$r



# Online Appendix Model 4 = Paper Model 4 with region dummy varaibles added
test <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model4 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + tt(eu.dep.on.gdp) + dep.on.eu.gdp + tt(dep.on.eu.gdp) + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model4
summary(model4)$r








#Online Appendix Model 5 = Paper Model 1 with alternative knots (12, 60, 120)
test <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model5 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 60, 120),
                                                Boundary.knots = FALSE), cluster(neg.id))
model5
summary(model5)$r




#Online Appendix Model 6 = Paper Model 2 with alternative knots (12, 60, 120)
test <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model6 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 60, 120),
                                                Boundary.knots = FALSE), cluster(neg.id))
model6
summary(model6)$r




#Online Appendix Model 7 = Paper Model 3 with alternative knots (12, 60, 120)
test <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model7 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + tt(eu.dep.on.trade) + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 60, 120),
                                                Boundary.knots = FALSE), cluster(neg.id))
model7
summary(model7)$r




#Online Appendix Model 8 = Paper Model 4 with alternative knots (12, 60, 120)
test <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model8 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + tt(eu.dep.on.gdp) + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 60, 120),
                                                Boundary.knots = FALSE), cluster(neg.id))
model8
summary(model8)$r






#Online Appendix Model 9 = Paper Model 1 with alternative knots (24, 48, 96)
test <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model9 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(24, 48, 96),
                                                Boundary.knots = FALSE), cluster(neg.id))
model9
summary(model9)$r




#Online Appendix Model 10 = Paper Model 2 with alternative knots (12, 48, 96)
test <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model10 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(24, 48, 96),
                                                Boundary.knots = FALSE), cluster(neg.id))
model10
summary(model10)$r




#Online Appendix Model 11 = Paper Model 3 with alternative knots (24, 48, 96)
test <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model11 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + tt(eu.dep.on.trade) + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(24, 48, 96),
                                                Boundary.knots = FALSE), cluster(neg.id))
model11
summary(model11)$r




#Online Appendix Model 12 = Paper Model 4 with alternative knots (24, 48, 96)
test <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model12 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + tt(eu.dep.on.gdp) + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(24, 48, 96),
                                                Boundary.knots = FALSE), cluster(neg.id))
model12
summary(model12)$r




#Online Appendix Model 13 = Paper Model 1 without knots (just using the 5-year windows to control for time issues)
model13 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final, cluster(neg.id))
model13


#Online Appendix Model 14 = Paper Model 2 without knots (just using the 5-year windows to control for time issues)
model14 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final, cluster(neg.id))
model14


#Online Appendix Model 15 = Paper Model 3 without knots (just using the 5-year windows to control for time issues)
model15 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final, cluster(neg.id))
model15


#Online Appendix Model 16 = Paper Model 4 without knots (just using the 5-year windows to control for time issues)
model16 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final, cluster(neg.id))
model16




#Online Appendix Model 17 = Paper Model 1 without knots (just using the 5-year windows to control for time issues) with region dummies
model17 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final, cluster(neg.id))
model17


#Online Appendix Model 18 = Paper Model 2 without knots (just using the 5-year windows to control for time issues) with region dummies
model18 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final, cluster(neg.id))
model18


#Online Appendix Model 19 = Paper Model 3 without knots (just using the 5-year windows to control for time issues) with region dummies
model19 <- coxph(Surv(t0, duration, neg.end) ~ trade.gdp.asymmetry + eu.dep.on.trade + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final, cluster(neg.id))
model19


#Online Appendix Model 20 = Paper Model 4 without knots (just using the 5-year windows to control for time issues) with region dummies
model20 <- coxph(Surv(t0, duration, neg.end) ~ trade.share.asymmetry + eu.dep.on.gdp + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(africa) + factor(asia) + factor(middle_east) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final, cluster(neg.id))
model20




# Online Appendix Model 21 = Paper Model 3 without the asymmetry measure (only looking at monadic BATNAs)
test <- coxph(Surv(t0, duration, neg.end) ~ eu.dep.on.trade + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model21 <- coxph(Surv(t0, duration, neg.end) ~ eu.dep.on.trade + tt(eu.dep.on.trade) + dep.on.eu.trade + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model21




# Online Appendix Model 22 = Paper Model 4 without the asymmetry measure (only looking at monadic BATNAs)
test <- coxph(Surv(t0, duration, neg.end) ~ eu.dep.on.gdp + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties + factor(stalled) + factor(late80s) + factor(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) , data=final)
test
cox.zph(test)

model22 <- coxph(Surv(t0, duration, neg.end) ~ eu.dep.on.gdp + tt(eu.dep.on.gdp) + dep.on.eu.gdp + relative.gdp.log + factor(europe) + factor(updating) + num.parties+ + factor(stalled) + factor(late80s) + factor(early90s) + tt(early90s) + factor(late90s) + factor(early00s) + factor(late00s) + factor(early10s) + factor(late10s) ,
                data=final,
                tt = function(x, t, ...) x* nsk(t, knots=c(12, 36, 72),
                                                Boundary.knots = FALSE), cluster(neg.id))
model22


#CREATE TABLES FOR ONLINE APPENDIX
library(stargazer)

stargazer(model1, model2, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU", align=TRUE, star.cutoffs = c(0.05))
stargazer(model3, model4, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU (includes monadic BATNAs)", align=TRUE, star.cutoffs = c(0.05))
stargazer(model5, model6, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU", align=TRUE, star.cutoffs = c(0.05))
stargazer(model7, model8, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU (includes monadic BATNAs)", align=TRUE, star.cutoffs = c(0.05))
stargazer(model9, model10, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU", align=TRUE, star.cutoffs = c(0.05))
stargazer(model11, model12, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU (includes monadic BATNAs)", align=TRUE, star.cutoffs = c(0.05))
stargazer(model13, model14, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU ", align=TRUE, star.cutoffs = c(0.05))
stargazer(model15, model16, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU (includes monadic BATNAs)", align=TRUE, star.cutoffs = c(0.05))
stargazer(model17, model18, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU ", align=TRUE, star.cutoffs = c(0.05))
stargazer(model19, model20, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU (includes monadic BATNAs)", align=TRUE, star.cutoffs = c(0.05))
stargazer(model21, model22, title="Analyzing the Risk of an Agreement Being Reached in a Trade Negotiation with the EU (only includes monadic BATNAs)", align=TRUE, star.cutoffs = c(0.05))




